var express = require('express');

var router = express.Router();

var url = require('url');

var userDetail = require('./user_data.js');
var data = require("./circle_data.js");

router.all("*", function(req, res, next) {
	res.header("Access-Control-Allow-Origin", "*");
	res.header("Access-Control-Allow-Headers", "X-Requested-With");
	res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
	res.header("X-Powered-By", ' 3.2.1');
	res.header("Content-Type", "application/json;charset=utf-8");
	next();
});

// 个人信息数据
router.get('/mine/mydetail',function(req,res){
	
		var id = req.query.id;
		var mydetail = userDetail.mydetail;
		var userData ={};
		for(var i =0;i<mydetail.length;i++){
			if(mydetail[i]['ofansID']==id){
				userData=mydetail[i];
			}
		}
		res.send(200,userData);

})

// 圈子首页数据
router.get("/circle_overall", function(req, res) {
		res.json(200, data);
});

module.exports=router;
